
<%
	/**
	 * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
	 *
	 * This library is free software; you can redistribute it and/or modify it under
	 * the terms of the GNU Lesser General Public License as published by the Free
	 * Software Foundation; either version 2.1 of the License, or (at your option)
	 * any later version.
	 *
	 * This library is distributed in the hope that it will be useful, but WITHOUT
	 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
	 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
	 * details.
	 */
%>

<%@include file="/init.jsp"%>

<p>
	<img
		src="<%=renderResponse.encodeURL(renderRequest.getContextPath())
					+ "/images/inkwell-pen-logo.jpg"%>"
		border="0" />
</p>

<p>
	<a href='<portlet:actionURL name="editDisplayRegistrations"/>'><liferay-ui:message
			key="display-registrations" /></a>
</p>

<liferay-ui:success key="productSaved"
	message="product-saved-successfully" />
<liferay-ui:success key="productDeleted" message="productDeleted" />
<liferay-ui:success key="productUpdated" message="productUpdated" />
<liferay-ui:error key="fields-required" message="fields-required" />
<liferay-ui:error key="error-deleting" message="error-deleting" />
<liferay-ui:error key="error-updating" message="error-updating" />

<c:if
	test='<%=PortletPermissionUtil.contains(permissionChecker,
						portletDisplay.getId(), "ADD_PRODUCT")%>'>

	<portlet:actionURL name="addProduct" var="addProductURL" />

	<aui:form name="fm" action="<%=addProductURL.toString()%>"
		method="post">

		<aui:fieldset>

			<aui:input name="productName" size="45"></aui:input>
			<aui:input name="productSerial" size="45"></aui:input>

			<aui:button-row>
				<aui:button type="submit" value="Add"></aui:button>
			</aui:button-row>

		</aui:fieldset>

	</aui:form>

	<liferay-ui:search-container
		emptyResultsMessage="there-are-no-products" delta="5">

		<liferay-ui:search-container-results>
			<%
				List<PRProduct> tempResults = ActionUtil
									.getProducts(renderRequest);

							results = ListUtil.subList(tempResults,
									searchContainer.getStart(),
									searchContainer.getEnd());
							total = tempResults.size();

							pageContext.setAttribute("results", results);
							pageContext.setAttribute("total", total);
			%>
		</liferay-ui:search-container-results>

		<liferay-ui:search-container-row
			className="com.inkwell.internet.productregistration.model.PRProduct"
			keyProperty="productId" modelVar="product">

			<liferay-ui:search-container-column-text name="product-name"
				property="productName" />
			<liferay-ui:search-container-column-text name="product-serial"
				property="serialNumber" />
			<liferay-ui:search-container-column-jsp
				path="/admin/admin_actions.jsp" align="right" />

		</liferay-ui:search-container-row>

		<liferay-ui:search-iterator />
	</liferay-ui:search-container>

</c:if>